package com.skyz.base.util;

import android.content.Context;

import com.lzj.pass.dialog.PayPassDialog;
import com.lzj.pass.dialog.PayPassView;

/**
 * 输入支付密码弹窗
 */
public class InputPwdDialog {

    /**
     * 按钮对外接口
     */
    public interface OnPwdDoneListener {
        void onDone(String password);
        void onClickResetPwd();
    }
    private OnPwdDoneListener myOnPwdDoneListener;

    public void setPwdDoneListener(OnPwdDoneListener listener) {
        myOnPwdDoneListener = listener;
    }


    private PayPassDialog dialog;

    public void showInputPwd (Context context) {

        dialog = new PayPassDialog(context);
        dialog.getPayViewPass()
                .setRandomNumber(true)
                .setPayClickListener(new PayPassView.OnPayClickListener() {
                    @Override
                    public void onPassFinish(String passContent) {
                        //6位输入完成回调
                        dialog.dismiss();
                        myOnPwdDoneListener.onDone(passContent);
                    }
                    @Override
                    public void onPayClose() {
                        dialog.dismiss();
                        //关闭弹框
                    }
                    @Override
                    public void onPayForget() {
                        dialog.dismiss();
                        myOnPwdDoneListener.onClickResetPwd();
                        //点击忘记密码回调
                    }
                });
    }

}
